package com.mtnz.njk.Util;

import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;
import com.mtnz.njk.entity.NjkUserEntity;
import org.springframework.stereotype.Service;

/**
* @Description:    根据用户手机号生成token
* @Author:         FBL
* @CreateDate:     2019\7\5 0005 7:26
* @Version:        1.0
*/
@Service
public class TokenService {
    public String getToken(NjkUserEntity user) throws Exception{
        String token = "";
        token = JWT.create().withAudience(user.getPhone()).sign(Algorithm.HMAC256(user.getPhone()));
        return token;
    }
}
